<template>
	<view style="width: 100%;min-height: 100vh;overflow: hidden;"
		:style="{background:'url('+Imgbase+'/1zhan_new_sbgc2.jpg)','background-size':'100%',}">

		<view class="zinde">
			<view class="" style="padding: 105rpx 40rpx 0;position: relative;z-index: 99999;" @click="goback">
				<image class="w-60 h-90 margin-top-10" :src="Imgbase + '/kp_setting_back.png'" mode="aspectFit"></image>
			</view>
			<view class="title">
				<image class="w-220 h-100" :src="Imgbase + '/1zhan_new_freetitle.png'" mode="aspectFit"></image>
			</view>
		</view>

		<!-- 分段器 -->
		<view class="subt">
			<u-subsection :list="list" :current="subcur" mode="subsection" activeColor="#F68C50" fontSize="14"
				inactiveColor="#000" @change="tabcur"></u-subsection>
		</view>

		<scroll-view class="padding-20" scroll-y="true" show-scrollbar="true" style="height: 80vh;">
			<view class=" list_item padding-15 radius-8 margin-bottom-15 df" v-for="(item,index) in poorlist"
				:key="index" @click="godeta(item.id)">
				<view class="w-200 h-200" style="border: 2rpx solid #F68C50;">
					<image class="w100 h100" :src="item.adimage" mode="aspectFit"></image>
				</view>
				<view class="padding-left-15">
					<view class="font-35 font-weight-500">
						{{item.name}}
					</view>
					<view class="font-25 padding-top-10" v-if="item.is_join == 1&&subcur == 0">
						已参与
					</view>
					<view class="font-25 padding-top-10" v-if="item.is_join == 0&&subcur == 0">
						未参与
					</view>
					<view class="font-25 padding-top-10" v-if="item.open_type == 1">
						开奖时间: {{item.open_day_time}}
					</view>
					<view class="font-25 padding-top-10" v-if="item.open_type == 2">
						开奖时间: 无开奖时间条件
					</view>
					<view class="font-25 padding-top-10" v-if="item.open_type == 1">
						开奖人数: 无开奖人数条件
					</view>
					<view class="font-25 padding-top-10" v-if="item.open_type == 2">
						开奖人数: {{item.open_user_num}}人
					</view>
					<view class="font-25 padding-top-10" v-if="item.remark !== ''">
						活动条件: 满{{item.remark}}人开奖
					</view>
					<view class="df alc">
						<view class="df alc">
							<image class="w-55 h-55" :src="Imgbase + '/1zhan_new_freeliwu.png'" mode="aspectFit">
							</image>
							{{item.goods_num}}份
						</view>
						<view class="df alc padding-left-20" v-if="subcur == 0">
							<image class="w-40 h-40" :src="Imgbase + '/1zhan_new_freeren.png'" mode="aspectFit">
							</image>
							<text v-if="item.is_join == 1">共参与{{item.join_num}}人</text>
							<text v-else>共参与*人</text>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				Imgbase: getApp().globalData.Imgbase,
				list: ['进行中', '已结束'],
				subcur: 0,
				page: 1,
				poorlist: []
			}
		},
		onLoad(e) {
		},
		onShow() {
			this.poorList(1)
		},
		methods: {
			godeta(e) {
				uni.navigateTo({
					url: '/pagesA/advanced/poordetail?id=' + e + '&time=' + this.subcur
				});
			},
			async poorList(e) {
				let item = await this.$api.post('delay/poorList', {
					token: uni.getStorageSync('token'),
					page: this.page,
					limit: 30,
					type: this.subcur + 1
				})
				if(e == 1){
					this.poorlist = item.data.list
				}else{
					this.poorlist = this.poorlist.concat(item.data.list)
				}

			},
			goback() {
				uni.navigateBack()
			},
			tabcur(e) {
				this.subcur = e
				this.poorlist = []
				this.poorList()
			}
		},
	}
</script>

<style lang="less" scoped>
	.list_item {
		border: 4rpx solid #F68C50;
	}

	.subt {
		width: 80%;
		margin: 15rpx auto;
		border: 2rpx solid #F68C50;
	}

	.zinde {
		position: relative;
		z-index: 99;

		.title {
			position: absolute;
			width: 100%;
			text-align: center;
			top: 115rpx;
			color: #fff;
			font-size: 40rpx;
			font-weight: bold;
			text-shadow: 6rpx 6rpx 6rpx #3b3b3b;
		}
	}
</style>